Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

339
Visualizações
BLE Using WinRT: Access Denied When Executing "GetCharacteristicsForUuidAsync()" for Write Characteristic

Maybe someone can help me out because I have a really tricky situation with Bluetooth LE using WinRT on Windows 10 (like supposed here: Bluetooth Low Energy in .Net (C#)).

I need BLE within a Win32 classic desktop application. Our code is running in a 32 Bit frame application using the .NET runtime (v4.0.30319, .NET Framework 4.6.2). I was able to manage all the other issues (strong naming some NuGet assemblies (Shiny.BluetoothLE), running BluetoothAdapter.GetRadioAsync() in a 64 Bit COM surrogate DLL when running on 64 Bit Windows) but now I am totally stuck with this and here’s where:

The problem occurrs when executing var result = await gattDeviceService.GetCharacteristicsForUuidAsync(uuid, BluetoothCacheMode.Cached); see here https://docs.microsoft.com/de-de/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattdeviceservice.getcharacteristicsforuuidasync?view=winrt-20348. When getting the read characteristics, the result.Status is GattCommunicationStatus.Success and the result contains the desired characteristic. But of course I also need to get the write characteristic and I am ALWAYS getting GattCommunicationStatus.AccessDenied! Because of that the result contains NO characteristic.

Has anybody a clue why is that? I really need help here because I am kinda lost right now…

I also tried to set AccessPermission via registry like supposed here but no luck at all…

PS: I use Windows 10 SDK Kit Build 20348 and like stated above it is a C# .NET Framework 4.6.2 project and all our assemblies are strong named because of using GAC. If I am missing anything don’t hesitate to contact me.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

For anyone who stumbles over the same stupid issue...Here's the solution:

On Windows, using .NET Framework 4.6.1+ and the WinRT libraries inside a Non-UWP application, you can only call ONCE for getting the characteristics, no matter if you call for all at once via gattDeviceService.GetCharacteristicsAsync(BluetoothCacheMode.Uncached) or for a specific one via gattDeviceService.GetCharacteristicsForUuidAsync(uuid, BluetoothCacheMode.Cached).

Any subsequent calls will fail with GattCommunicationStatus.AccessDenied... So my solution now is to retrieve all characteristics at once and filter them locally.

That did the trick! Anyways, this is so stupid...It wasted a lot of my time now! As it seems, I also do not need to set any AccessPermission via registry.

PS: I will call out to you, if I stumble over another tricky situation, just to let you guyz know.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda